package tests;

import java.util.concurrent.Semaphore;

import core.Prover;

public class RunTest extends Thread {
	
	public volatile boolean result;
	
	private volatile boolean finished = false;
	
	private final Semaphore mutex;
	
	private final Prover prover;
	
	private final Test test;
	
	public RunTest(Semaphore mArg, Prover pArg, Test tArg) {
		mutex = mArg;
		prover = pArg;
		test = tArg;
	}
	
	public void run() {
		SetTestResult(prover.solve(test.termArgument, test.term));
		mutex.release();
	}
	
	public synchronized boolean IsTestFinished() {
		return finished;
	}
	
	private synchronized void SetTestResult(boolean rArg) {
		result = rArg;
		finished = true;
	}

}
